#include "piped.hpp"


int main()
{
    int fd = open(FIFO_FILE,O_WRONLY);
    if(fd == -1){
        perror("open");
        exit(FIFO_OPEN_ERR);
    }
    std::cout << "client open file done" << std::endl;
    
    while(true)
    {
        std::string str;
        std::cout <<"Please Enter@";
        getline(std::cin, str);
        std::cout<<str<<std::endl;
        int n = write(fd,str.c_str(),str.size());
        if(n == -1)
        {
            perror("write");
            exit(FIFO_WRITE_ERR);
        }
    }
    

    close(fd);
    return 0;
}